<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>案例</title>
  <style>
    table {
      margin: 10px auto;
      /* 合并相邻边框 */
      border-collapse: collapse;
    }

    table,
    th,
    td {
      border: 1px solid #000;
    }
  </style>
</head>

<body>

  <div class="box">
    <h4>订单确认</h4>
    <!-- <table>
      <thead>
        <th>商品名称</th>
        <th>商品价格</th>
        <th>商品数量</th>
        <th>总价</th>
        <th>收获地址</th>
      </thead>

      <tbody>
        <tr>
          <td>12</td>
          <td>12</td>
          <td>12</td>
          <td>12</td>
          <td>12</td>
        </tr>
      </tbody>
    </table> -->
  </div>

  <script>
    let name = prompt('请输入商品名称')
    let price = +prompt('请输入商品价格')
    let num = +prompt('请输入商品数量')
    let address = prompt('请输入收获地址')
    document.write(
      `
      <table>
      <thead>
        <th>商品名称</th>
        <th>商品价格</th>
        <th>商品数量</th>
        <th>总价</th>
        <th>收获地址</th>
      </thead>

      <tbody>
        <tr>
          <td>${name}</td>
          <td>${price}</td>
          <td>${num}</td>
          <td>${price * num}</td>
          <td>${address}</td>
        </tr>
      </tbody>
    </table>
      `
    )
  </script>
</body>

</html>